package com.nhncorp.pleiades.protocol;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import com.nhncorp.pleiades.hadoop.Writable;
import com.nhncorp.pleiades.hadoop.WritableUtils;

public class ClientSessionInfo implements Writable {
  private String hostName;
  private int loadStatus;
  private int cpuUsage;
  private int memUsage;
  private int diskUsage;
  
  public ClientSessionInfo() {
    this.hostName = "";
  }
  
  public ClientSessionInfo(String hostName) {
    this.hostName = hostName;
  }

  public String getHostName() {
    return hostName;
  }
  
  
  public boolean equals(Object obj) {
    if( !(obj instanceof ClientSessionInfo) )  return false;
    
    ClientSessionInfo otherClientInfo = (ClientSessionInfo)obj;
    return hostName.equals(otherClientInfo.hostName);
  }
  
  
  public int hashCode() {
    return hostName.hashCode();
  }
  
  public void readFields(DataInput in) throws IOException {
    hostName = WritableUtils.readString(in);
  }

  public void write(DataOutput out) throws IOException {
    WritableUtils.writeString(out, hostName);
  }
  
  public String toString() {
    return hostName;
  }
}
